﻿#include "PostWindowBase.h"
#include <QDebug>
#include <vtkOutputWindow.h>
#include <QCoreApplication.h>

namespace pst
{
    PostWindowBase::PostWindowBase(QWidget* parent/*, int caseID*//*, BaseModule::GraphWindowType type*/)
        //: QFDialog(parent)
        //, m_caseID(caseID)
        //, _graphWindowType(type)
        : m_ChineseFontPath()
        , m_EnglishFontPath()
    {
        vtkOutputWindow::SetGlobalWarningDisplay(0);
        //只有最大化和关闭按钮
        //setWindowButtonType(QBase::Close | QBase::Maximize);
        initFontFiles();
    }

    PostWindowBase::~PostWindowBase()
    {
    }

    //void PostWindowBase::updateWindowTitle()
    //{
    //    setBaseWindowTitle(windowTitle());
    //}

    //BaseModule::GraphWindowType PostWindowBase::getGraphWindowType()
    //{
    //    return _graphWindowType;
    //}

    void PostWindowBase::saveImage(QString str, int w, int h, bool s, bool aotoSize)
    {

    }

    void PostWindowBase::connectSignals()
    {

    }

    //int PostWindowBase::getCaseID()
    //{
    //    return m_caseID;
    //}

    QString PostWindowBase::getEnglishFontPath()
    {
        return m_EnglishFontPath;
    }

    QString PostWindowBase::getChineseFontPath()
    {
        return m_ChineseFontPath;
    }

    void PostWindowBase::setView(QString view)
    {
        if (view.toLower() == "fit")
            fitView();
        else if (view.toLower() == "xplus")
            setViewXPlus();
        else if (view.toLower() == "xminus")
            setViewXMiuns();
        else if (view.toLower() == "yplus")
            setViewYPlus();
        else if (view.toLower() == "yminus")
            setViewYMiuns();
        else if (view.toLower() == "zplus")
            setViewZPlus();
        else if (view.toLower() == "zminus")
            setViewZMiuns();
        else if (view.toLower() == "trimetric")
            setViewTrimetric();
    }
    void  PostWindowBase::setViewValue(int x1, int x2, int x3, int y1, int y2, int y3, int z1, int z2, int z3)
    {
        setViewValue(x1, x2, x3, y1, y2, y3, z1, z2, z3);
    }

    /*void  PostWindowBase::setViewPreValue(int x1, int x2, int x3, int y1, int y2, int y3, int z1, int z2, int z3)
    {
    setViewPreValue(x1, x2, x3, y1, y2, y3, z1, z2, z3);
    }*/

    void PostWindowBase::fitView()
    {
    }

    void PostWindowBase::setViewXPlus()
    {
    }

    void PostWindowBase::setViewXMiuns()
    {
    }

    void PostWindowBase::setViewYPlus()
    {
    }

    void PostWindowBase::setViewYMiuns()
    {
    }

    void PostWindowBase::setViewZPlus()
    {
    }

    void PostWindowBase::setViewZMiuns()
    {
    }

    void PostWindowBase::setViewTrimetric()
    {
    }

    void PostWindowBase::setBackGround(QColor color1, QColor color2)
    {

    }

    //void PostWindowBase::keyPressEvent(QKeyEvent* e)
    //{
    //    qDebug() << "base press event";
    //    QWidget::keyPressEvent(e);
    //}

    //void PostWindowBase::keyReleaseEvent(QKeyEvent* e)
    //{
    //    qDebug() << "base release event";
    //    QWidget::keyReleaseEvent(e);
    //}

    void PostWindowBase::initFontFiles()
    {
        //应需求，title显示为选择文件界面选择文件的翻译名
        // vtk不能直接使用qt的资源文件，qt资源文件的绝对路径也难以获取，因此采用字体相对于exe的相对路径传递给vtk
        QString currenEXEPath = QCoreApplication::applicationDirPath();
        m_ChineseFontPath = currenEXEPath + "/ConfigFiles/Alibaba-PuHuiTi-Regular.ttf";
        m_EnglishFontPath = currenEXEPath + "/ConfigFiles/Alibaba-PuHuiTi-Regular.ttf";
    }

    void PostWindowBase::reTranslate()
    {

    }

    void PostWindowBase::HandleCurveMSG(QString id, vtkActor* act)
    {
        qDebug() << "Subclass not implemented";
    }

    void PostWindowBase::HandlePointMSG(int id, double* pos)
    {
        qDebug() << "Subclass not implemented";
    }

    void PostWindowBase::showMarkedPoints(bool show)
    {
        qDebug() << "Subclass not implemented";
    }

    void PostWindowBase::setCatchBallSize(double r)
    {
        qDebug() << "Subclass not implemented";
    }

    void PostWindowBase::setCatchBallPosition(double* r)
    {
        qDebug() << "Subclass not implemented";
    }

    //QString PostWindowBase::getStringGraphWindowType()
    //{
    //    QString type;
    //    switch (_graphWindowType)
    //    {
    //    case BaseModule::UnDefined:
    //        break;
    //    case BaseModule::PreWindows:
    //        type = "PreWindow"; break;
    //    case BaseModule::RealTime:
    //        type = "RealTime"; break;
    //    default:
    //        break;
    //    }
    //    return type;
    //}

    void PostWindowBase::leftClickedActorAndPointId(vtkActor* actor, int id)
    {
        qDebug() << "PostWindowBase::leftClickedActorAndPointId not implemented";
    }

    void PostWindowBase::rightClickedActorAndPointId(vtkActor* actor, int id)
    {
        qDebug() << "PostWindowBase::rightClickedActorAndPointId not implemented";
    }

    //void PostWindowBase::setWindow()
    //{
    //    // 设置自己为自定义页面内容（必须）
    //    setPageContent(this);
    //    // 设置标题（必须）
    //    setBaseWindowTitle(windowTitle());
    //    // 设置为非模态界面
    //    setBaseWindowModality(Qt::WindowModality::NonModal);
    //    // 设置为窗口显示
    //    setBaseWindowState(Qt::WindowState::WindowNoState);
    //    // 设置显示按钮: 关闭
    //    setWindowButtonType(QBase::Close | QBase::Maximize | QBase::Minimize);
    //    // 重置父类
    //    //resetParent(_mainWindow);
    //    // 设置焦点
    //    setFocus();
    //}
}
